const router = require('koa-router')();
const word = require('../modules/word');

//获取数据
router.get('/word',async (ctx,next) => {
    ctx.body = await word.selectWord();  
})
//增加数据
router.post('/word',async (ctx,next) => {
    ctx.body = await word.addWord(ctx.request.body)
})
//删除数据
router.delete('/word/:id',async (ctx,next) => {
    ctx.body = await word.deleteWord(ctx.params);
})
//修改数据
router.put('/word',async (ctx,next) => {
    ctx.body = await word.putWord(ctx.request.body)
})

module.exports = router;